home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / CGI / DOWNLOAD.CGI-S=TEXTCLOCK&C=TXT&F=TEXTCLOCK.PL < prev    next >
Perl Script  |  1996-06-03  |  4KB  |  134 lines

  1. #!/usr/local/bin/perl
  2. ##############################################################################
  3. # TextClock                     Version 1.0.2                                #
  4. # Copyright 1996 Matt Wright    mattw@worldwidemart.com                      #
  5. # Created 7/15/96               Last Modified 7/15/96                        #
  6. # Scripts Archive at:           http://www.worldwidemart.com/scripts/        #
  7. ##############################################################################
  8. # COPYRIGHT NOTICE                                                           #
  9. # Copyright 1996 Matthew M. Wright  All Rights Reserved.                     #
  10. #                                                                            #
  11. # TextClock may be used and modified free of charge by anyone so long as     #
  12. # this copyright notice and the comments above remain intact.  By using this #
  13. # code you agree to indemnify Matthew M. Wright from any liability that      #  
  14. # might arise from it's use.                                                 #  
  15. #                                                                            #
  16. # Selling the code for this program without prior written consent is         #
  17. # expressly forbidden.  In other words, please ask first before you try and  #
  18. # make money off of my program.                                              #
  19. #                                                                            #
  20. # Obtain permission before redistributing this software over the Internet or #
  21. # in any other medium.  In all cases copyright and header must remain intact #
  22. ##############################################################################
  23. # Define Variables                                 #
  24.  
  25. $Display_Week_Day = '1';
  26.  
  27. $Display_Month = '1';
  28.  
  29. $Display_Month_Day = '1';
  30.  
  31. $Display_Year = '1';
  32.  
  33. $Display_Time = '1';
  34.  
  35. $Display_Time_Zone = '1';
  36.  
  37. $Standard_Time_Zone = 'EST';
  38. $Daylight_Time_Zone = 'EDT';
  39.  
  40. $Display_Link = '1';
  41.  
  42. # Done                                         #
  43. ##############################################################################
  44.  
  45. @Week_Days = ('Sunday','Monday','Tuesday','Wednesday',
  46.           'Thursday','Friday','Saturday');
  47.  
  48. @Months = ('January','February','March','April','May','June','July',
  49.        'August','September','October','November','December');
  50.  
  51.  
  52. print "Content-type: text/html\n\n";
  53.  
  54. if ($Display_Link != 0) {
  55.     print "<a href=\"http://www.worldwidemart.com/scripts/\">";
  56. }
  57.  
  58. ($Second,$Minute,$Hour,$Month_Day,
  59. $Month,$Year,$Week_Day,$IsDST) = (localtime)[0,1,2,3,4,5,6,8]; 
  60.  
  61. if ($IsDST == 1) {
  62.     $Time_Zone = $Daylight_Time_Zone;
  63. }
  64. else {
  65.     $Time_Zone = $Standard_Time_Zone;
  66. }
  67.  
  68. if ($Second < 10) {
  69.     $Second = "0$Second"; 
  70. }
  71. if ($Minute < 10) {
  72.     $Minute = "0$Minute"; 
  73. }
  74. if ($Hour < 10) {
  75.     $Hour = "0$Hour"; 
  76. }
  77. if ($Month_Day < 10) {
  78.     $Month_Day = "0$Month_Day"; 
  79. }
  80. if ($Year > 95) {
  81.     $Year = "19$Year"; 
  82. }
  83. elsif ($Year < 10) {
  84.     $Year = "200$Year"; 
  85. }
  86. else {
  87.     $Year = "20$Year"; 
  88. }
  89.  
  90. if ($Display_Week_Day != 0) {
  91.     print "$Week_Days[$Week_Day]";
  92.     if ($Display_Month != 0) {
  93.         print ", ";
  94.     }
  95. }
  96.  
  97. if ($Display_Month != 0) {
  98.     print "$Months[$Month] ";
  99. }
  100.  
  101. if ($Display_Month_Day != 0) {
  102.     print "$Month_Day";
  103.     if ($Display_Year != 0) {
  104.         print ", ";
  105.     }
  106. }
  107.  
  108. if ($Display_Year != 0) {
  109.     print "$Year";
  110.     if ($Display_Time != 0) {
  111.         print " - ";
  112.     }
  113.     elsif ($Display_Time_Zone != 0) {
  114.         print " ";
  115.     }
  116. }
  117.  
  118. if ($Display_Time != 0) {
  119.     print "$Hour\:$Minute\:$Second";
  120.     if ($Display_Time_Zone != 0) {
  121.         print " ";
  122.     }
  123. }
  124.  
  125. if ($Display_Time_Zone != 0) {
  126.     print "$Time_Zone";
  127. }
  128.  
  129. if ($Display_Link != 0) {
  130.     print "</a>";
  131. }
  132.  
  133. exit;
  134.